const nodemailer = require("nodemailer");

const transporter = nodemailer.createTransport({
  host: "smtp.qq.com",
  port: 465,
  secure: true,
  auth: {
    user: process.env.MAIL_USER,
    pass: process.env.MAIL_PASS,
  },
});

async function sendMail() {
  const info = await transporter.sendMail({
    from: process.env.MAIL_USER, // sender address
    to: "zpjgsby@qq.com", // han3099942916@163.com", // list of receivers
    subject: "面试邀请", // Subject line
    text: "恭喜通过简历筛选，我们邀请您在2023年9月16日22:32:50参加我们的视频面试", // plain text body
  });

  console.log("Message sent: %s", info.messageId);
  return info;
}

module.exports = {
  sendMail,
};
